{extend name="public/base" /} {block name="style"}
<link href="__LIB__/fileinput/css/fileinput.min.css" rel="stylesheet" /> {/block} {block name="body"}
<div class="content-tabs">
	<ol class="breadcrumb">
		<li>
			<a href="{:url('index/index')}"><i class="fa fa-home"></i></a>
		</li>
		<li>
			<a href="{:url('index')}">公告管理</a>
		</li>
		<li><strong>编辑公告</strong></li>
	</ol>
</div>
<div class="ibox float-e-margins">
	<div class="ibox-content">
		<form id="myForm" class="form-horizontal m-t" method="post" action="{:url('edit')}">
			<input type="hidden" name="id" value="{$ad.id}" />
			<div class="form-group">
				<label class="col-sm-3 control-label">标题：</label>
				<div class="input-group col-sm-4">
					<input type="text" id="title" name="title" value="{$ad.title}" class="form-control" />
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label">链接url：</label>
				<div class="input-group col-sm-4">
					<input type="text" id="url" name="url" value="{$ad.url}" class="form-control" />
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">广告图：</label>
				<div class="input-group col-sm-4">
					<input type="hidden" id="thumb" name="thumb" value="{$ad.thumb}" />
					<input id="upload" name="upload" type="file" />
				</div>
			</div>
			<div class="hr-line-dashed"></div>
			<div class="form-group">
				<label class="col-sm-3 control-label">开始时间：</label>
				<div class="input-group col-sm-4">
					<input id='start_time' name='start_time' value="{$ad.start_time}" style="width: 185px;" onclick='WdatePicker()' type='text' class='dfinput' />
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">结束时间：</label>
				<div class="input-group col-sm-4">
					<input id='end_time' name='end_time' value="{$ad.end_time}" style="width: 185px;" onclick='WdatePicker()' type='text' class='dfinput' />
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">排序：</label>
				<div class="input-group col-sm-4">
					<input type="text" id="sort" name="sort" value="{$ad.sort}" class="form-control" />
				</div>
			</div>
			<div class="hr-line-dashed"></div>
			<div class="form-group">
				<div class="col-sm-4 col-sm-offset-3">
					<button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 保存</button>&nbsp;&nbsp;
					<a href="{:url('index')}" class="btn btn-danger"><i class="fa fa-arrow-left"></i> 返回 </a>
				</div>
			</div>
		</form>
	</div>
</div>
{/block} {block name="script"}
<script src="__JS__/jquery.form.js"></script>
<script src="__LIB__/validate/jquery.validate.min.js"></script>
<script src="__LIB__/validate/messages_zh.min.js"></script>
<script src="__LIB__/validate/add_validate.min.js"></script>
<script src="__LIB__/fileinput/js/fileinput.min.js"></script>
<script src="__LIB__/fileinput/js/locales/zh.js"></script>
<script src="__LIB__/datepicker/WdatePicker.js"></script>
<script>
	upload_one('{$ad.thumb}');
	$("input[name='type'][value='{$ad.type}']").attr("checked", true);
	$(function() {
		$("#myForm").validate({
			rules: {
				title: "required",
				type: "required"
			},
			messages: {
				title: ICON.error + "请输入标题",
				type: ICON.error + "请选择类型"
			},
			submitHandler: function(form) {
				ajaxForm();
			}
		});
	});
</script>
{/block}